/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author wyr
 */
@Entity
@Table(name = "news_extends_firstchannel_buttons")
//@NamedQueries({@NamedQuery(name = "NewsExtendsFirstchannelButtons.findAll", query = "SELECT n FROM NewsExtendsFirstchannelButtons n"), @NamedQuery(name = "NewsExtendsFirstchannelButtons.findByChannelid", query = "SELECT n FROM NewsExtendsFirstchannelButtons n WHERE n.newsExtendsFirstchannelButtonsPK.channelid = :channelid"), @NamedQuery(name = "NewsExtendsFirstchannelButtons.findByButtonid", query = "SELECT n FROM NewsExtendsFirstchannelButtons n WHERE n.newsExtendsFirstchannelButtonsPK.buttonid = :buttonid"), @NamedQuery(name = "NewsExtendsFirstchannelButtons.findByButtonorder", query = "SELECT n FROM NewsExtendsFirstchannelButtons n WHERE n.buttonorder = :buttonorder")})
public class NewsExtendsFirstchannelButtons implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected NewsExtendsFirstchannelButtonsPK newsExtendsFirstchannelButtonsPK;
    @Column(name = "buttonorder")
    private Integer buttonorder;
    @JoinColumn(name = "buttonid", referencedColumnName = "buttonid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NewsButtons newsButtons;
    @JoinColumn(name = "channelid", referencedColumnName = "channelid", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NewsExtendsFirstchannel newsExtendsFirstchannel;

    public NewsExtendsFirstchannelButtons() {
    }

    public NewsExtendsFirstchannelButtons(NewsExtendsFirstchannelButtonsPK newsExtendsFirstchannelButtonsPK) {
        this.newsExtendsFirstchannelButtonsPK = newsExtendsFirstchannelButtonsPK;
    }

    public NewsExtendsFirstchannelButtons(int channelid, int buttonid) {
        this.newsExtendsFirstchannelButtonsPK = new NewsExtendsFirstchannelButtonsPK(channelid, buttonid);
    }

    public NewsExtendsFirstchannelButtonsPK getNewsExtendsFirstchannelButtonsPK() {
        return newsExtendsFirstchannelButtonsPK;
    }

    public void setNewsExtendsFirstchannelButtonsPK(NewsExtendsFirstchannelButtonsPK newsExtendsFirstchannelButtonsPK) {
        this.newsExtendsFirstchannelButtonsPK = newsExtendsFirstchannelButtonsPK;
    }

    public Integer getButtonorder() {
        return buttonorder;
    }

    public void setButtonorder(Integer buttonorder) {
        this.buttonorder = buttonorder;
    }

    public NewsButtons getNewsButtons() {
        return newsButtons;
    }

    public void setNewsButtons(NewsButtons newsButtons) {
        this.newsButtons = newsButtons;
    }

    public NewsExtendsFirstchannel getNewsExtendsFirstchannel() {
        return newsExtendsFirstchannel;
    }

    public void setNewsExtendsFirstchannel(NewsExtendsFirstchannel newsExtendsFirstchannel) {
        this.newsExtendsFirstchannel = newsExtendsFirstchannel;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (newsExtendsFirstchannelButtonsPK != null ? newsExtendsFirstchannelButtonsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewsExtendsFirstchannelButtons)) {
            return false;
        }
        NewsExtendsFirstchannelButtons other = (NewsExtendsFirstchannelButtons) object;
        if ((this.newsExtendsFirstchannelButtonsPK == null && other.newsExtendsFirstchannelButtonsPK != null) || (this.newsExtendsFirstchannelButtonsPK != null && !this.newsExtendsFirstchannelButtonsPK.equals(other.newsExtendsFirstchannelButtonsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.dp.vo.NewsExtendsFirstchannelButtons[newsExtendsFirstchannelButtonsPK=" + newsExtendsFirstchannelButtonsPK + "]";
    }

}
